# Contributor: Elly Fong-Jones <elly@elly.town>
# Maintainer: Elly Fong-Jones <elly@elly.town>
pkgname=angband
pkgver=4.2.5
pkgrel=0
pkgdesc="Roguelike computer role playing game"
url="https://rephial.org"
arch="all"
# License: GPL-2.0-only for the actual code, but the tile sets (which this build
# includes) have different licenses. See docs/copying.rst in the source tree for
# full details.
license="GPL-2.0-only AND custom"
makedepends="ncurses-dev sdl2-dev sdl2_image-dev sdl2_mixer-dev sdl2_ttf-dev"
checkdepends="perl"
source="https://github.com/angband/angband/releases/download/$pkgver/Angband-$pkgver.tar.gz"
builddir="$srcdir/Angband-$pkgver"

# Angband has a unit test suite, but it requires the game to be installed
# to run: https://github.com/angband/angband/issues/5517
options="!check"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/usr/bin \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-curses \
		--disable-x11 \
		--enable-sdl2 \
		--disable-sdl \
		--disable-test \
		--disable-stats
	make
}

check() {
	make tests
	# Note: there are also a handful of integration tests, but they don't
	# have a separate build target and instead compile extra code into
	# the production binary. We don't want the extra code size, so they
	# aren't run here.
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
5d907849da64c27b16ebd8fac839eb7db72d7f2352671c57545beea6700dfd1c5b3387e6a222da12ef066329c28108d03bad6e84c99ab8bcb68513adbb71aad1  Angband-4.2.5.tar.gz
"
